package cz.cvut.fel.stats;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/**
 *  This singleton class is used for thread safe storage of statistics
 * @author Tomba
 *
 */
public class Statistics {
	private static Statistics stats = null;
	/**
	 *  Number of docs processed
	 */
	public AtomicInteger docs  = new AtomicInteger();
	/**
	 * Latency for the operation
	 */	
	public AtomicLong latency = new AtomicLong();

	
	public static synchronized Statistics getInstance() {		
		if (stats == null) {
			stats = new Statistics();
		}
			
		return stats;
	}
	
	public void add() {
		docs.getAndIncrement();
	}
}
